package com.xiaoke.api.service;

import com.xiaoke.entity.Goods;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient("service")
public interface GoodsService {

    @PostMapping("/goods/findByParams")
    List<Goods> findByParams(@RequestBody Map<String, Object> params, @RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize);

    @GetMapping("/goods/getDetailById")
    Map<String,Object> getDetailById(@RequestParam("id") String id);

//    @PostMapping("/goods/getByFilter")
//    List<Map<String,Object>> getByFilter(@RequestBody Map<String, Object> params);

    @PostMapping("/goods/getByParams")
    List<Map<String,Object>> getByParams(@RequestBody  Map<String, Object> params);

    @GetMapping("/goods/countByShop")
    Integer countByShop(@RequestParam("shopId") String shopId);

    @GetMapping("/goods/selectByPrimaryKey")
    Goods selectByPrimaryKey(@RequestParam("id") String id);

    @PostMapping("/goods/findTotalPriceByIds")
    Map<String,Object> findTotalPriceByIds(@RequestBody String... id);

    @PostMapping("/goods/findTotalPriceByIds")
    Map<String,Object> countTotalPriceByGoodsPriceIds (@RequestBody String... id);

    @GetMapping("/goods/findByCategoryAndShop")
    List<Map<String,Object>> findByCategoryAndShop(@RequestParam("categoryId") Integer categoryId,@RequestParam("shopId") String shopId);
}
